package com.yuan.plugin.view;

import com.yuan.myplugin.R;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class ImageToast extends Toast {

	public ImageToast(Context context, String msg, int imgId) {
		super(context);
		LayoutInflater inflater = LayoutInflater.from(context);
		View view = inflater.inflate(R.layout.toast_image, null);
		TextView textView = (TextView) view.findViewById(R.id.toast_msg);
		ImageView imageView = (ImageView) view.findViewById(R.id.toast_img);
		textView.setText(msg);
		imageView.setImageResource(imgId);
		setDuration(Toast.LENGTH_SHORT);
		setGravity(Gravity.CENTER, 0, 0);
		setView(view);
	}
}
